<template>
  <div></div>
</template>
<script lang="ts">
import { Component, Vue, Prop } from "vue-property-decorator";
import MapCommon from "@/util/MapCommon";
import SicknessDistribute from "./SicknessDistribute";
import { sicknessServer } from "@/api/installServer";

@Component({
  name: "SicknessDistributeTest",
  components: {},
  mixins: [MapCommon]
})
export default class SicknessDistributeTest extends Vue {
  private mapId: string = "";
  private getComponent: any;

  private mounted() {
    // 地图容器id
    this.mapId = "map";
    (this as any).resolveMap(this.mapId).then((data: any) => {
      this.init(data.map);
      this.load()
    });
  }

  //  地图加载完成后，初始化
  private init(map: any) {
    const temp: any = this;
    // 地图配置
    const mapConfig = temp.$ioc.resolve(`mapConfig-${this.mapId}`);
    // 符号配置
    const symbolConfig = temp.$ioc.resolve(`symbolConfig-${this.mapId}`);
    // 通用的地图组件实例
    const GISComponents = temp.$ioc.resolve(`GISComponents-${this.mapId}`);
    //
    const component = new SicknessDistribute({
      map,
      service: sicknessServer,
      symbolConfig,
      simpleRenderMgr: GISComponents.simpleRenderMgr,
      popupManager: GISComponents.popupManager,
      PointGeometryBuilder: GISComponents.PointGeometryBuilder,
      featureLocate: GISComponents.featureLocate,
      featureHighlight: GISComponents.featureHighlight
    });
    this.getComponent = () => {
      return component;
    };
  }

  private load() {
    this.getComponent().load();
  }
}
</script>
<style lang="less" scoped>
</style>